
/*
 * Copyright 2002-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2020原作者。
 *
 *根据Apache许可证2.0版（“许可证”）获得许可；
 *除非符合许可证，否则不得使用此文件。
 *您可以在以下地址获取许可证副本：
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证分发的内容是按“原样”分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限和
 *许可证下的限制。
 */

package org.springframework.aop.config;

import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;

/**
 * {@code NamespaceHandler} for the {@code aop} namespace.
 *
 * <p>Provides a {@link org.springframework.beans.factory.xml.BeanDefinitionParser} for the
 * {@code <aop:config>} tag. A {@code config} tag can include nested
 * {@code pointcut}, {@code advisor} and {@code aspect} tags.
 *
 * <p>The {@code pointcut} tag allows for creation of named
 * {@link AspectJExpressionPointcut} beans using a simple syntax:
 * <pre class="code">
 * &lt;aop:pointcut id=&quot;getNameCalls&quot; expression=&quot;execution(* *..ITestBean.getName(..))&quot;/&gt;
 * </pre>
 *
 * <p>Using the {@code advisor} tag you can configure an {@link org.springframework.aop.Advisor}
 * and have it applied to all relevant beans in you {@link org.springframework.beans.factory.BeanFactory}
 * automatically. The {@code advisor} tag supports both in-line and referenced
 * {@link org.springframework.aop.Pointcut Pointcuts}:
 *
 * <pre class="code">
 * &lt;aop:advisor id=&quot;getAgeAdvisor&quot;
 *     pointcut=&quot;execution(* *..ITestBean.getAge(..))&quot;
 *     advice-ref=&quot;getAgeCounter&quot;/&gt;
 *
 * &lt;aop:advisor id=&quot;getNameAdvisor&quot;
 *     pointcut-ref=&quot;getNameCalls&quot;
 *     advice-ref=&quot;getNameCounter&quot;/&gt;</pre>
 *
 * @author Rob Harrop
 * @author Adrian Colyer
 * @author Juergen Hoeller
 * @since 2.0
 */
/**
 *｛@code aop｝命名空间的｛@codeNamespaceHandler｝。
 *
 *＜p＞为
 *｛@code＜aop:config＞｝标记。｛@code config｝标记可以包含嵌套
 *{@code切入点}、{@code顾问}和{@code方面}标记。
 *
 *＜p＞｛@code pointcut｝标记允许创建命名
 *｛@link AspectJExpressionPointcut｝bean使用简单语法：
 *<pre-class=“code”>
 *&lt；aop：切入点id＝“”；“获取名称调用”；表达式＝“0”；执行（**..ITestBean.getName（..））“/&gt；
 *</pre>
 *
 *＜p＞使用｛@codeadvisor｝标记，您可以配置｛@linkorg.springframework.aop.advisor｝
 *并将其应用于｛@linkorg.springframework.beans.factory.BeanFactory｝中的所有相关bean
 *自动。｛@code advisor｝标记支持内联和引用
 *｛@link org.springframework.aop.Pointcut Pointcuts｝：
 *
 *<pre-class=“code”>
 *&lt；aop:advisor id＝“”；“获取AgeAdvisor”；
 *切入点＝“；执行（**..ITestBean.getAge（..））“；
 *建议ref＝“；“获取AgeCounter”/&gt；
 *
 *&lt；aop:advisor id＝“”；“获取名称顾问”；
 *切入点ref＝“0”；“获取名称调用”；
 *建议ref＝“；“获取名称计数器”/&gt</前>
 *
 *@作者Rob Harrop
 *@作者Adrian Colyer
 *@作者Juergen Hoeller
 *@自2.0起
 */
public class AopNamespaceHandler extends NamespaceHandlerSupport {

	/**
	 * Register the {@link BeanDefinitionParser BeanDefinitionParsers} for the
	 * '{@code config}', '{@code spring-configured}', '{@code aspectj-autoproxy}'
	 * and '{@code scoped-proxy}' tags.
	 */
	/**
	 *为
	 *“｛@code config｝”、“｛@code spring configured｝”和“｛@code aspectj autoproxy｝”
	 *和“｛@code scoped proxy｝”标记。
	 */
	@Override
	public void init() {
		// In 2.0 XSD as well as in 2.5+ XSDs
		// 在2.0 XSD以及2.5+XSD中
		registerBeanDefinitionParser("config", new ConfigBeanDefinitionParser());
		registerBeanDefinitionParser("aspectj-autoproxy", new AspectJAutoProxyBeanDefinitionParser());
		registerBeanDefinitionDecorator("scoped-proxy", new ScopedProxyBeanDefinitionDecorator());

		// Only in 2.0 XSD: moved to context namespace in 2.5+
		// 仅在2.0 XSD中：在2.5中移动到上下文命名空间+
		registerBeanDefinitionParser("spring-configured", new SpringConfiguredBeanDefinitionParser());
	}

}
